package com.ruoyi.teaching.index;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "item")
public class Item {
    @Id
    private Long id;
    @Field(name = "title",type = FieldType.Text,index = true,analyzer="ik_max_word")
    private String title; //标题
    @Field(value="category",type = FieldType.Keyword,index = false)
    private String category;// 分类
    @Field(value="brand",type = FieldType.Keyword,index = false)
    private String brand; // 品牌
    @Field(value="price",type = FieldType.Double)
    private Double price; // 价格
    @Field(value="images",type = FieldType.Keyword,index = false)
    private String images; // 图片地址
    @Field(type = FieldType.Date,format = DateFormat.date_time)
    private Date createTime; // 创建日期

}